package advance.clone;

public class ShallowCopy implements Cloneable {

    private int a = 1;

    private String s = "str";

    private User user;

    public int getA() {
        return a;
    }

    public void setA(int a) {
        this.a = a;
    }

    public String getS() {
        return s;
    }

    public void setS(String s) {
        this.s = s;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public static void main(String[] args) throws CloneNotSupportedException {
        ShallowCopy sc = new ShallowCopy();
        sc.setA(1);
        sc.setS("str2");
        User u = new User();
        u.setAge(23);
        u.setName("Mr.w");
        sc.setUser(u);

        User u2 = new User();
        u2.setAge(27);
        u2.setName("Mr.y");

        System.out.println(sc.getUser().getAge());
        System.out.println(sc.getUser().getName());
    }
}
